﻿using System.Collections.Generic;
using System.Linq;

namespace zaklad_rtv
{
    public class MultipleCriteria<T> : ICriteria<T> where T : IDatabaseObject
    {
        private readonly List<ICriteria<T>> _criteria;

        public MultipleCriteria()
        {
            _criteria = new List<ICriteria<T>>();
        }

        public bool IsMatched(T item)
        {
            return _criteria.All(c => c.IsMatched(item));
        }

        public void AddCriterion(ICriteria<T> criteria)
        {
            _criteria.Add(criteria);
        }
    }
}